Previous Book Contents Book Index Next

Inside Macintosh: AppleScript Language Guide / Part 2 - AppleScript Language Reference
Chapter 6 - Expressions / Operations
Operators That Handle Operands of Various Classes


Greater Than, Less Than

The Greater Than and Less Than operators work with dates, integers, real numbers, and strings.

DATE
A date is greater than another date if it represents a later time. A date is less than another date if it represents an earlier time.

INTEGER
An integer is greater than a real number or another integer if it represents a larger number. An integer is less than a real number or another integer if it represents a smaller number.

REAL
A real number is greater than an integer or another real number if it represents a larger number. A real number is less than an integer or another real number if it represents a smaller number.

STRING
A string is greater than (comes after) another string if it would appear after the other string in an English-language dictionary. For example,

"zebra" comes after "aardvark"
and

"zebra" > "aardvark"
are true. A string is less than (comes before) another string if it would appear in a dictionary before the other string. For example,

"aardvark" comes before "zebra"
and

"aardvark" < "zebra"
are true.

AppleScript uses the ASCII collating sequence to determine a word's position in an English-language dictionary. The order of the ASCII collating sequence is

space!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTU 
VWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
AppleScript compares strings character by character. When the corresponding characters in two strings are not the same, the string containing the character closest to the beginning of the ASCII collating sequence is less than the other string. If two strings have identical characters but one is shorter than the other, the shorter string is less than the longer string. AppleScript treats all letters as lowercase letters, unless you use a Considering statement to consider the case attribute. For more information about Considering statements, refer to "Considering and Ignoring Statements" on page 213.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
13 JUL 1996